﻿using Abp;
using Abp.Dependency;
using Abp.Notifications;
using FwProject.ManagerNotification.DataDto;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;

namespace FwProject.ManagerNotification
{
    /// <summary>
    /// 发布通知
    /// </summary>
    public class PublishNotifications : ITransientDependency
    {
        private readonly INotificationPublisher _notiticationPublisher;

        public PublishNotifications(INotificationPublisher notiticationPublisher)
        {
            _notiticationPublisher = notiticationPublisher;
        }

        #region 订单通知
        /// <summary>
        /// 发布订单通知
        /// </summary>
        /// <param name="notificationTitle">通知标题</param>
        /// <param name="shopProductUrl"></param>
        /// <param name="targetUserId"></param>
        /// <returns></returns>
        public async Task Publish_OrderOperation(OrderOperationNotificationData orderOperationNotificationData)
        {
            //await _notiticationPublisher.PublishAsync("ConfirmOrder", new OrderOperationNotificationData(shopProductUrl, friendshipMessage), userIds: new[] { targetUserId });
            await _notiticationPublisher.PublishAsync(NotificationTypeHelp.ORDERNOTIFICATION, orderOperationNotificationData, userIds: orderOperationNotificationData.UserIdentifier == null ? null : new[] { orderOperationNotificationData.UserIdentifier });
        }
        #endregion

    }
}
